!> 终端单元测试
module test_fffc_terminal

    use testdrive, only: new_unittest, unittest_type, error_type, check
    use fffc_terminal, only: terminal, progress_bar
    implicit none

    private
    public :: collect_terminal

contains

    subroutine collect_terminal(testsuite)
        type(unittest_type), allocatable, intent(out) :: testsuite(:)

        allocate (testsuite, source=[ &
                  new_unittest('warning', test_warning), &
                  new_unittest('progress_bar', test_progress_bar) &
                  ])

    end subroutine collect_terminal

    subroutine test_warning(error)
        type(error_type), allocatable, intent(out) :: error
        type(terminal) :: terminal_obj


        call terminal_obj%init(use_color=.true.)
        call terminal_obj%warning('this is a warning')
        call terminal_obj%success("this is a success")
        call terminal_obj%info("this is a info")
        print *, terminal_obj%magenta("this is a magenta")
        print *, terminal_obj%cyan("this is a cyan")

    end subroutine test_warning

    subroutine test_progress_bar(error)
        type(error_type), allocatable, intent(out) :: error

        call progress_bar(11, 10, advance=.true.)

    end subroutine test_progress_bar

end module test_fffc_terminal
